const http = require('http');
const server = http.createServer();
server.listen('3000', () => console.log('获取请求成功'));
server.on('request', (req, res) => {
    //通过req可以获取所有和请求相关的信息
    console.log(req.method); //获取请求的方式
    console.log(req.url); //获取请求的url
    console.log(req.headers) //获取请求头
})